Harden Windows build setup#840
Merged
tgauth merged 2 commits intoPowerShell:latestw_allfrom Apr 27, 2026
Merged
Conversation
- Prefer VS 2017/2019/2022 over newer installs (e.g. VS 2026) when vswhere reports both, so a host with a newer VS installed alongside VS 2022 still builds with v143. Without this the downstream Select-String version checks miss and the VS 2015 fallback dereferences a null VS140COMNTOOLS. - Pin vcpkg's CMake with VCPKG_VISUAL_STUDIO_PATH and VCPKG_PLATFORM_TOOLSET=v143 so it uses the same toolset as the .vcxproj files, avoiding MSB8040 (Spectre-libs missing for v145) when vcpkg would otherwise pick up a newer VS. - Fall back to the repo root for OpenSSH-build.ps1 -destination when \$env:WORKSPACE is unset. CI still has its WORKSPACE value, and no longer invokes this script directly anyway. - Document Windows build prerequisites in README.txt: VS 2022 Desktop C++ workload, v143 Spectre-mitigated libs, Git, the one-time vcpkg bootstrap/integrate step, and the need to run from an elevated PowerShell.
2 tasks
The .vcxproj files pin PlatformToolset v143, which ships with VS 2022. VS 2017 (v141) and VS 2019 (v142) would need v143 build tools sideloaded to build this, which is a non-default setup — so they shouldn't be treated as equals to VS 2022 in the preference order.
f32a045 to
c55ef23
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
@eransha-salvador - please review the Contributor License Agreement mentioned above |
There was a problem hiding this comment.
Pull request overview
Hardens the Windows build scripts to consistently select a supported Visual Studio toolset (v143) and improves local usability/documentation for building Win32-OpenSSH.
Changes:
- Prefer VS 2022 for MSBuild discovery and pin vcpkg to the same VS install and
v143toolset. - Make
OpenSSH-build.ps1runnable outside CI by defaulting$destinationwhenWORKSPACEis unset. - Add/expand Windows build prerequisites documentation in
README.txt.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| contrib/win32/openssh/README.txt | Documents Windows build prerequisites and clarifies admin PowerShell requirement. |
| contrib/win32/openssh/OpenSSHBuildHelper.psm1 | Prefers VS 2022 in discovery and pins vcpkg to VS path + v143. |
| contrib/win32/openssh/OpenSSH-build.ps1 | Adjusts default artifact destination when WORKSPACE is not set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
@microsoft-github-policy-service agree |
Author
|
@microsoft-github-policy-service agree |
1 similar comment
Author
|
@microsoft-github-policy-service agree |
tgauth
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VCPKG_VISUAL_STUDIO_PATH/VCPKG_PLATFORM_TOOLSET=v143so vcpkg's CMake matches the.vcxprojtoolset.$env:WORKSPACEis unset soOpenSSH-build.ps1is runnable outside CI.README.txt.Fixes PowerShell/Win32-OpenSSH#2434
Test plan
Start-OpenSSHBuildon a host with both VS 2022 and VS 2026 installed; verify v143 toolset is selected and build succeeds.OpenSSH-build.ps1locally (noWORKSPACEset) and verify artifacts land in the repo root.README.txtand build end-to-end.